package com.backend.demo1.models;

public class User {

    private Long id;
    private String Username;
    private String Password;
    private Role role; // 用户所属角色
    private String captcha;

    // 无参构造方法
    public User() {}
    public Long getid() {
        return id;
    }

    public void setid(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return Username;
    }

    public void setUsername(String username) {
        this.Username = username;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String password) {
        this.Password = password;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Long getRoleid() {
        // 从 role 对象中获取 id
        return role != null ? role.getid() : null;
    }

    public void setRoleid(Long roleid) {
        // 创建一个新的 Role 对象并设置 id
        if (roleid != null) {
            Role newRole = new Role();
            newRole.setid(roleid);
            this.role = newRole;
        } else {
            this.role = null;
        }
    }
    public String getCaptcha() {
        return captcha;
    }

    public String setCaptcha(String captcha) {
        return this.captcha = captcha;
    }

}